<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>需求详情</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="${ctxStatic }/mui/css/mui.min.css" rel="stylesheet" />
<link rel="stylesheet" href="${ctxStatic }/wx/css/pensonal.css" />
<script type="text/javascript" src="${ctxStatic }/zepto/zepto.min.js" ></script>
<script src="${ctxStatic }/wx/mui/js/mui.min.js"></script>
	<style>
		.mui-table-view:after{
			background: none;
		}
	</style>
</head>
<body>
		<div id="customs-a" class="mui-page">
			<div class="mui-navbar-inner mui-bar mui-bar-nav">
				<button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left" style="color: #fff;">
					<span class="mui-icon mui-icon-left-nav"  style="color: #fff;"></span>定制需求
				</button>
				<h1 class="mui-center mui-title" style="color: #fff;">需求详情</h1>
			</div>
			<div class="mui-content">
			<form method="post" action="${ctxWx}/custom/customReact"id="subForm">
				<input type="hidden" name="demandid" value="${param.demandid}"/>
			</form>
				<ul class="mui-table-view customs-body">
					<li class="mui-table-view-cell customs-il">
						<span>出发城市</span>
						<span>${tDemands.sendAddress}</span>
					</li>
					<li class="mui-table-view-cell customs-il">
						<span>到达城市</span>
						<span>${tDemands.destcity.sitename}</span>
					</li>
					<li class="mui-table-view-cell customs-il">
						<span>行程描述</span>
						<span>${tDemands.modeldesc}</span>
					</li>
					<li class="mui-table-view-cell customs-il">
						<span>选择车型</span>
						<span>${tDemands.cartype.typename}</span>
					</li>
					<li class="mui-table-view-cell customs-il">
						<span>包车数量</span>
						<span>${tDemands.vehiclenum}</span>
					</li>
					<li class="mui-table-view-cell customs-il">
						<span>用车时间</span>
						<span>${tDemands.fromdateStr}</span>
					</li>
					<li class="mui-table-view-cell customs-il">
						<span>联系人</span>
						<span>${tDemands.contactor}</span>
					</li>
					<li class="mui-table-view-cell customs-il">
						<span>联系电话</span>
						<span>${tDemands.contactphone}</span>
					</li>
					<li class="mui-table-view-cell customs-il">
						<span>反馈状态</span>
						<span>
							<c:if test="${tDemands.reactstatus==1}">待响应</c:if>
							<c:if test="${tDemands.reactstatus==2}">已响应</c:if>
							<c:if test="${tDemands.reactstatus==3}">已支付</c:if>
							<c:if test="${tDemands.reactstatus==4}">已取消</c:if>
						</span>
					</li>
				</ul>

			</div>
			<c:if test="${tDemands.reactstatus!=4}">
			<nav class="mui-bar mui-bar-tab" style="background: #fff;">
				<div class="mui-col-xs-6 response">
					<button id="subBtn" >响应车队</button>
				</div>
				<div class="mui-col-xs-6 re-cancel" >
					<button id="cancelBtn" >取消</button>
				</div>
			</nav>
			</c:if>
			<c:if test="${tDemands.reactstatus==4}">
			<nav class="mui-bar mui-bar-tab" style="background: #fff；">
				<div class="mui-col-xs-6 response">
					<button id="delBtn" >删除需求</button>
				</div>
				<div class="mui-col-xs-6 re-cancel" style="display: none;">
					<button id="cancelBtn" >取消</button>
				</div>
			</nav>
			</c:if>
		</div>
		<script type="text/javascript">
			mui.init()
			Zepto(function(){
				document.getElementById("cancelBtn").addEventListener('tap', function() {
						mui.confirm('是否取消该需求吗？', function(e) {
							if (e.index == 1) {//点击确认
								mui.post('${ctxFront}/mobile/cancelDemand',{demandid:'${param.demandid}'},function(d){
									var code = d.code;
									if (d.code=='200') {//取消订单成功
										mui.alert(d.message,function(){
											window.location.href = "${ctxWx}/my/myInfoPage";
										})
									} else{
										mui.alert(d.message);
									}
								})
							} else {  //点击取消
							}
						})
					});
					if('${tDemands.reactstatus}'=='4'){
						document.getElementById("delBtn").addEventListener('tap', function() {
						mui.confirm('是否删除该需求吗？', function(e) {
							if (e.index == 1) {//点击确认
								mui.post('${ctxFront}/mobile/deleteDemand',{demandid:'${param.demandid}'},function(d){
									var code = d.code;
									if (d.code=='200') {//取消订单成功
										mui.alert("删除成功",function(){
											window.location.href = "${ctxWx}/my/myInfoPage";
										})
									} else{
										mui.alert(d.message);
									}
								})
							} 
						})
					});
					}
					if ('${tDemands.reactstatus}'!=2||'${tDemands.rectcount}'==0) {
						document.getElementById("subBtn").disabled=true;
					}else{
						document.getElementById("subBtn").disabled=false;
						document.getElementById("subBtn").addEventListener('tap', function() {
							$('#subForm').submit();
						});
					}
			})
		</script>
	</body>

</html>